﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Xml.Serialization;

namespace Samples.WebService.Models
{
    public class ProductCollection : KeyedCollection<int, Product>
    {
        protected override int GetKeyForItem(Product item)
        {
            return item.Id;
        }

        // This method is included as a workaround to an issue in the XmlSerializer
        // for more information see: http://www.pluralsight.com/blogs/craig/archive/2005/10/19/15696.aspx
        public new Product this[int index]
        {
            get { return ((IList<Product>)this)[index]; }
        }
    }
}